<template>
  <div>
    <TopBar>回款计划</TopBar>
    <section class="backPlanContainer"  style="margin-top:1.5rem">
      <BackInfo :item="item"></BackInfo>
      <div style="background-color:#f7f8fa;height:0.24rem"></div>
      <BackCalendar @money="getMoney" @getCurrentData="getCurrentData"></BackCalendar>
      <div class="infoMoney">回款金额(元) <span style="color:red">{{this.clickDateMoney}}</span></div>
      <div style="background-color:#f7f8fa;height:0.2rem;"></div>
      <div class="fontRow">
        当月回款总数(元) <span class="fontS" style="margin-right:.2rem">{{this.jyhk}}</span>
        当月回款笔数(笔) <span class="fontS" >{{this.jyhkbs}}</span>
      </div>
    </section>
  </div>
</template>
<script>
import TopBar from '../../component/common/TopBar'
import BackInfo from './children/BackInfo'
import BackCalendar from './children/BackCalendar'
import {getBackPlan} from '../../../service/getData.js'
import {getStore} from '../../../config/mUtils.js'
import {getSDK} from '../../../service/wxShare.js'

export default {
  components:{
    TopBar,
    BackInfo,
    BackCalendar
  },
  beforeCreate(){
    getSDK()
  },
  created(){
    let nowDate = new Date();
    let currentYear = nowDate.getFullYear();
    let currentMonth = nowDate.getMonth()+1;
    this.start = `${currentYear}-01-01`;
    this.end = `${currentYear}-12-31`;
    this.month = `${currentYear}-${currentMonth}`
  },
  mounted(){
    // getBackPlan(getStore('loginkey'),this.start,this.end,this.month)
    //   .then(res=>{
    //     //console.log(res)
    //     if(res.status == 1){
    //       this.item = res
    //       this.jyhk = res.jyhk
    //       this.jyhkbs = res.jyhkbs
    //     }
    //   })
  },
  computed:{
    current(){
      retrun;
    }
  },
  data(){
    return {
      start:'',
      end:'',
      month:'',
      item:{},
      clickDateMoney:'0',
      jyhk:'0',
      jyhkbs:'0'
    }
  },
  methods:{
    getMoney(data){
      this.clickDateMoney = data
    },
    getCurrentData(data){
      // //console.log(`${data.jyhkbs}/${data.jyhk}`);
      this.item = data
      this.jyhkbs = data.datalist?data.datalist.length : '0'
      this.jyhk = data.sumjy
    }
  }
}
</script>
<style lang="less">
  @import '../../../style/mixin.less';

  .backPlanContainer{
    .wh(90%,100%);
    margin: 0 auto;
    .infoMoney{
      text-align: center;
      margin-top: .4rem;
      margin-bottom:0.3rem
    }
    .fontRow{
      color:#b2b2b2;
      margin-top: .4rem;
      font-size: .36rem;
      .fontS{
        font-weight: bold;
        color:#000;
      }
    }
  }
</style>
